package com.example.xiao.httpprocessor.HttpProcessor

class HttpHelper : IHttpProcessor {

    override fun post(url: String, params: Map<String, Any>, callback: ICallBack) {
        //业务员找到有房子的人
        mIHttpProcessor!!.post(url, params, callback)
    }

    companion object {
        //有房子的人（持有具体那套网络请求库的引用）
        private var mIHttpProcessor: IHttpProcessor? = null

        fun init(httpProcessor: IHttpProcessor){
            mIHttpProcessor = httpProcessor
        }

        //单例模式
        private var instance: HttpHelper? = null
       @Synchronized fun getInstance():HttpHelper?{
           if (instance == null){
               instance = HttpHelper()
           }
           return instance
       }
    }
}